﻿using System;
using MassPokerTool.Infrastructure.Hooking.Data;
using MassPokerTool.Infrastructure.Logging;

namespace MassPokerTool.Infrastructure.Hooking
{
    public class MassPokerInterface : MarshalByRefObject
    {
        private readonly ILogger _log;

        public MassPokerInterface()
        {
            _log = new Logger(typeof(MassPokerInterface));
        }

        public void IsInstalled(Int32 inClientPid)
        {
            _log.Debug(string.Format("MassPokerTool has been installed in target {0}", inClientPid));
        }

        public bool Ping(Int32 inClientPid)
        {
            return AppsManager.IsHooked(inClientPid);
        }

        public void Process(IHookData hookData)
        {
            ProcessingEngine.Process(hookData);
        }

        public void ReportMessage(string message)
        {
            _log.Info(message);
        }

        public void ReportError(string message)
        {
            _log.Error("The target process has reported an error:\n" + message);
        }
    }
}
